import React from "react";
import {
  View,
  SafeAreaView,
  StatusBar,
  StyleSheet,
  Platform,
  ViewStyle,
} from "react-native";

// 定义组件的 props 类型
interface ContainerProps {
  children: React.ReactNode; // 允许传递任何 React 节点作为子元素
}
const statusBarHeight = StatusBar.currentHeight || 0;

const Container: React.FC<ContainerProps> = ({ children }) => {
  return (
    <SafeAreaView style={styles.container}>
      <View style={styles.content}>{children}</View>
    </SafeAreaView>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: "#000",
  } as ViewStyle,
  content: {
    flex: 1,
    paddingTop: Platform.OS === "android" ? statusBarHeight : 0, // 处理 Android 状态栏高度
    backgroundColor: "#000",
  } as ViewStyle,
});

export default Container;
